<template>
  <el-dialog title="设备列表" :visible.sync="isDialogShow" :before-close="closeEven" :destroy-on-close="true" :close-on-click-modal="false" width="60%">
    <el-row class="data-list">
      <el-table :data="lists" border class="table_box" style="width:100%" :empty-text="emptyText">
        <el-table-column prop="sn" label="设备号" align="center"></el-table-column>
        <el-table-column prop="status" label="发送状态" align="center">
          <template slot-scope="scope">
            <div v-if="scope.row.status === 1" style="color:red;">成功</div>
            <div v-if="scope.row.status === 2">失败</div>
          </template>
        </el-table-column>
        <el-table-column prop="result" label="失败原因" align="center"></el-table-column>
      </el-table>
      <paginate :callback="pageObj.callback" :page="pageObj.page"></paginate>
    </el-row>
  </el-dialog>
</template>
<script>
import paginate from 'components/common/paginate'
import { configloglist } from 'api/txEquipment/index'
export default {
  data () {
    return {
      isDialogShow: true,
      pageObj: { // 分页
        page: {},
        callback: this.getData
      },
      lists: []
    }
  },
  props: {
    logData: Object
  },
  components: {
    paginate
  },
  created () {
    this.getData(1)
  },
  methods: {
    closeEven () {
      this.$emit('beforeCloseEven')
    },
    getData (int) { // 获取数据
      configloglist({
        pageIndex: int - 1,
        pageSize: 10,
        config_id: this.logData.id
      }).then(res => {
        this.lists = res.data
        this.pageObj.page = res.page
      })
    }
  }
}
</script>
<style lang="less"></style>
